import request from "@/utils/request";
import {requestFilter} from "@/utils/tools";

const api = '/basics-domain/'

// 获取验证码
export async function fetchCode(params) {
    return await request.get(api + 'system/validateCode', {params: params, responseType: "arraybuffer"})
}

// 登录
export async function onLogin(params) {
    return await request.post(api + 'system/login', params)
}

// 添加系统用户
export async function addSystemUser(params) {
    return await request.post(api + 'system/addSystemUser', params)
}

// 解绑设备号
export async function unBindDevice(params) {
    return await request.post(api + 'system/removeDeviceId', params)
}

// 添加租户
export async function addTenantUser(params) {
    return await request.post(api + 'system/addTenantUser', params)
}


//  获取催收人员
export async function selectCollectionStaff(params) {
    return await request.get(api + 'system/collectionStaff', {params})
}

//  后台用户修改
export async function editSystemUser(params) {
    return await request.post(api + 'system/edit', params)
}

/**
 * 营销人员下拉
 * @param params type: 1数据 2共享 3流量 4复借 5转换
 */
export async function selectMarketingStaff(params) {
    return requestFilter('/system/marketingStaff') ? await request.get(api + 'system/marketingStaff', {params}) : {
        data: []
    }
}

//  退出登录
export async function loginOut() {
    return await request.get(api + 'system/out',)
}

//  获取所有产品
export async function selectProduct(params) {
    return requestFilter('/bindProduct/queryBindProduct') ? await request.get(api + 'bindProduct/queryBindProduct', {
        params: {
            ...params,
            key: new Date().getTime()
        }
    }) : {
        data: []
    }
}

//  获取所有租户
export async function selectTenant(params) {
    return requestFilter('/system/queryTenant') ? await request.get(api + 'system/queryTenant', {
        params,
        key: new Date().getTime()
    }) : {
        data: []
    }
}

//  获取提醒人员
export async function selectRemindStaff(params) {
    return requestFilter('/system/remindStaff') ? await request.get(api + 'system/remindStaff', {params}) : {
        data: []
    }
}

//  重置密码
export async function resetPassword(params) {
    return await request.get(api + 'system/resetPassword', {params})
}

//  获取信审员工分单比例
export async function fetchCreditRate(params) {
    return await request.get(api + 'system/selectAPPCredit', {params})
}

//  获取经理姓名
//type 角色类型 3信审经理 6 催收经理 8提醒经理 10营销经理
export async function selectManager(params) {
    return requestFilter('/system/selectManager') ? await request.get(api + 'system/selectManager', {params}) : {
        data: []
    }
}

//  获取经理用户
export async function selectManagerUser(params) {
    return requestFilter('/system/selectManagerUser') ? await request.get(api + 'system/selectManagerUser', {params}) : {
        data: []
    }
}

//  员工列表分页查询
export async function fetchStaffList(params) {
    return await request.get(api + 'system/staffSearch', {params})
}

//  获取信审员工
export async function selectAuditStaff(params) {
    return requestFilter('/system/creditStaff') ? await request.get(api + 'system/creditStaff', {params}) : {
        data: []
    }
}

//  查询当前登陆人员旗下所有员工
export async function selectStaff(params) {
    return await request.get(api + 'system/selectStaff', {params})
}

//  获取租户列表
export async function fetchTenantList(params) {
    return await request.get(api + 'system/tenantSearch', {params})
}

//  修改密码
export async function updatePassword(params) {
    return await request.post(api + 'system/updatePassword', params)
}

//  员工禁/启分单
export async function updateSingle(params) {
    return await request.post(api + 'system/updateSingle', params)
}

/***
 * 首页
 */
//  首页各项数据统计
export async function fetchHomeStatistics(params) {
    return await request.get(api + 'homePage/dataStatistics', {params})
}

//  首页今日数据统计
export async function fetchHomeTodayDataStatistics(params) {
    return await request.get(api + 'homePage/todayDataStatistics', {params})
}

//  数据趋势金额
export async function fetchHomeTrend(params) {
    return await request.get(api + 'homePage/dataTrend', {params})
}

//  今日数据统计---未结清数据
export async function todayNotSettleData(params) {
    return await request.get(api + 'homePage/todayNotSettleData', {params})
}

//  今日数据统计---入催数据
export async function todayOverdueData(params) {
    return await request.get(api + 'homePage/todayOverdueData', {params})
}

//  今日数据统计---打款数据
export async function todayPayData(params) {
    return await request.get(api + 'homePage/todayPayData', {params})
}

//  今日数据统计---应还数据
export async function todayShouldData(params) {
    return await request.get(api + 'homePage/todayShouldData', {params})
}

//  三日逾期催收总览
export async function day3OverdueCollection(params) {
    return await request.get(api + 'homePage/day3OverdueCollection', {params})
}

//  三日到期提醒数据总览
export async function day3ExpireRemind(params) {
    return await request.get(api + 'homePage/day3ExpireRemind', {params})
}

//  获取短信渠道
export async function selectSmsChannel(params) {
    return await request.get(api + 'productSms/selectSmsChannel', {params})
}

/**
 * 排班管理
 */
//  批量排班
export async function schedulingBatchInsert(params) {
    return await request.post(api + 'scheduling/batchInsert', params)
}

//  排班请假人数
export async function schedulingCount(params) {
    return await request.get(api + 'scheduling/count', {params})
}

//  排班列表
export async function fetchSchedulingList(params) {
    return await request.get(api + 'scheduling/list', {params})
}

//  排班状态更改
export async function schedulingUpdate(params) {
    return await request.post(api + 'scheduling/update', params)
}

/**
 *  员工管理
 */
//绑定产品
export async function bindingProduct(params) {
    return await request.post(api + 'bindProduct/binding', params)
}

// //  系统用户绑定的产品
// export async function queryBindProduct(params) {
//     return await request.get(api + 'bindProduct/queryBindProduct', {params})
// }

//解绑APP
export async function unbindProduct(params) {
    return await request.post(api + 'bindProduct/unbindApp', params)
}

//  系统用户已绑定的产品
export async function unboundProduct(params) {
    return await request.get(api + 'bindProduct/unbound', {params})
}

//修改信审员分单比列
export async function updateCreditAudit(params) {
    return await request.post(api + 'bindProduct/updateCreditAduit', params)
}

//  批量绑定产品查询
export async function searchBindProduct(params) {
    return await request.get(api + 'system/querySureBindProduct', {params})
}

//  启用/停用后台用户
export async function updateStatusSystemUser(params) {
    return await request.post(api + 'system/editStatus', params)
}

// 批量绑定产品确定
export async function batchBindProduct(params) {
    return await request.post(api + 'system/batchBindProduct', params)
}

/**
 * 权限管理
 * */
//  删除权限数据
export async function deleteMenu(params) {
    return await request.get(api + 'permission/deletePermission', {params})
}

//  权限启用/禁用
export async function changeStatusMenu(params) {
    return await request.post(api + 'permission/delete', params)
}

//  权限菜单列表
export async function fetchMenuList(params) {
    return await request.get(api + 'permission/menuList', {params})
}

//  获取当前登陆人菜单权限
export async function fetchPermissions(params) {
    return await request.post(api + 'permission/menuPermissions', params)
}

//  获取菜单角色
export async function fetchMenuRole(params) {
    return await request.get(api + 'permission/menuRole', {params})
}

//  菜单列表查询
export async function fetchMenuSearch(params) {
    return await request.get(api + 'permission/menuSearch', {params})
}

//  添加角色菜单权限
export async function addMenuPermission(params) {
    return await request.post(api + 'permission/roleMenuPermission', params)
}

//  获取当前登陆用户按钮
export async function selectButton(params) {
    return await request.get(api + 'permission/viewDetails', {params})
}

//  查询当前用户可配置权限
export async function selectConfigPermission(params) {
    return await request.post(api + 'permission/selectConfigPermission', params)
}

//  获取权限列表
export async function selectPermission(params) {
    return await request.get(api + 'permission/selectPermission', {params})
}

//  添加权限
export async function addPermission(params) {
    return await request.post(api + 'permission/addPermission', params)
}

//  获取菜单角色列表
export async function fetchPermissionRole(params) {
    return await request.get(api + 'permission/menuRole', {params})
}

//  修改权限
export async function permissionUpdate(params) {
    return await request.post(api + 'permission/update', params)
}

/**
 *  消息提醒
 * **/
// 获取数量
export async function fetchMessageRemindCount(params) {
    return await request.get(api + 'messageRemind/count', {params})
}

// 消息提醒列表
export async function fetchMessageRemind(params) {
    return await request.get(api + 'messageRemind/list', {params})
}

// 查看详情
export async function messageViewDetails(params) {
    return await request.get(api + 'messageRemind/viewDetails', {params})
}

/**
 * 系统设置
 * **/

// 删除
export async function deleteConfig(params) {
    return await request.post(api + 'systemConfig/deleteConfig', params)
}

// 查询参数-所有
export async function selectConfig(params) {
    return await request.get(api + 'systemConfig/selectAll', {params})
}

// 修改参数-所有
export async function updateConfig(params) {
    return await request.post(api + 'systemConfig/updateSystemConfig', params)
}

/**
 * 角色管理
 * **/
// 获取下级角色
export async function fetchLowerRole(params) {
    return await request.get(api + 'role/getLowerRole', {params})
}

// 获取信审接口
export async function searchRoleName(params) {
    return await request.get(api + 'role/searchRoleName', {params})
}

// 添加角色
export async function roleInsert(params) {
    return await request.post(api + 'role/insert', params)
}

// 编辑角色
export async function roleUpdate(params) {
    return await request.post(api + 'role/update', params)
}

// 查询
export async function fetchRole(params) {
    return await request.get(api + 'role/search', {params})
}

// 启用/禁用
export async function roleUpdateStatus(params) {
    return await request.get(api + 'role/updateStatus', {params})
}

//添加入网配置
export async function addNetwork(params) {
    return await request.post(api + 'role/addNetwork', params)
}

//入网配置查询
export async function fetchNetwork(params) {
    return await request.get(api + 'role/listNetwork', {params})
}

//修改入网配置
export async function updateNetwork(params) {
    return await request.post(api + 'role/updateNetwork', params)
}

//修改入网配置状态
export async function updateNetworkStatus(params) {
    return await request.post(api + 'role/updateNetworkStatus', params)
}

/**
 * 短信列表
 * **/
//查询
export async function fetchSmsList(params) {
    return await request.get(api + 'smsStencil/search', {params})
}

//启/禁用状态
export async function smsUpdateStatus(params) {
    return await request.post(api + 'smsStencil/editStatus', params)
}

/**
 * 资金管理
 * **/
//租户充值
export async function tenantRecharge(params) {
    return await request.post(api + 'topUp/recharge', params)
}

//充值列表
export async function rechargeList(params) {
    return await request.get(api + 'topUp/search', {params})
}

//充值总计
export async function rechargeTotal(params) {
    return await request.get(api + 'topUp/total', {params})
}

/**
 *  发布公告
 * **/

//添加公告
export async function systemNoticeAdd(params) {
    return await request.post(api + 'systemNotice/add', params)
}

//删除系统公告
export async function systemNoticeDelete(params) {
    return await request.get(api + 'systemNotice/delete', {params})
}

//公告列表
export async function systemNoticeList(params) {
    return await request.post(api + 'systemNotice/list', params)
}

//修改公告
export async function systemNoticeUpdate(params) {
    return await request.post(api + 'systemNotice/update', params)
}

//修改公告状态
export async function systemNoticeUpdateStatus(params) {
    return await request.post(api + 'systemNotice/updateStatus', params)
}

/**
 * 用户反馈
 * **/
//用户反馈列表
export async function userFeedbackList(params) {
    return await request.post(api + 'userFeedback/list', params)
}

//修改用户反馈备注
export async function updateRemarks(params) {
    return await request.post(api + 'userFeedback/updateRemarks', params)
}

/**
 * 日志管理
 * **/
//获取操作日志
export async function operationLogList(params) {
    return await request.get(api + 'operationLog/list', {params})
}

//获取登录日志
export async function loginLogList(params) {
    return await request.get(api + 'loginLog/list', {params})
}

//添加更新日志
export async function systemUpdateLogAdd(params) {
    return await request.post(api + 'systemUpdateLog/add', params)
}

//更新日志列表
export async function systemUpdateLogList(params) {
    return await request.get(api + 'systemUpdateLog/list', {params})
}

//更新日志
export async function systemUpdateLogUpdate(params) {
    return await request.post(api + 'systemUpdateLog/update', params)
}

/**
 * 交易记录
 * **/
//交易总计
export async function dealRecordTotal(params) {
    return await request.get(api + 'dealInfo/amountTotal', {params})
}

//交易类型
export async function dealType(params) {
    return await request.get(api + 'dealInfo/dealType', {params})
}

//交易类型总计
export async function dealTypeTotal(params) {
    return await request.get(api + 'dealInfo/dealTypeTotal', {params})
}

//交易记录查询
export async function dealRecordList(params) {
    return await request.get(api + 'dealInfo/search', {params})
}

/**
 * 语音群呼列表
 * **/
//查询
export async function voiceCallList(params) {
    return await request.get(api + 'voiceStencil/search', {params})
}

//启/禁用状态
export async function voiceCallUpdateStatus(params) {
    return await request.post(api + 'voiceStencil/updateValid', params)
}

/**
 *  分时段营销通话报表
 * */
// 获取分时段营销通话报表
export async function fetchMarketCallPhoneReport(params) {
    return await request.get(api + 'report/nxPhoneReport', {params})
}
// 获取分时段营销通话报表合计
export async function fetchMarketCallPhoneReportTotal(params) {
    return await request.get(api + 'report/nxPhoneReportTotal', {params})
}
